package servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;

@WebServlet("/LogoutServlet")
public class LogoutServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 销毁 session，清除用户信息
        HttpSession session = request.getSession();
        session.invalidate();
        response.sendRedirect("index.html"); // 跳转到首页
    }
}
